/*
 * @Author: hq
 * @Date: 2022-07-14 15:10:41
 * @LastEditors: hq
 * @LastEditTime: 2022-07-15 09:41:30
 * @Description: your project
 * @version: 1.0
 */
//obj   传入后端返回的路由数据obj
function dynamicRoute(obj) {
    const accessRouteses = obj
    //动态路由循环解析和添加
    accessRouteses.forEach(v => {
        v.children = routerChildren(v.children);
        v.component = routerCom(v.route);
        router.addRoute(v); //加入router
    })
}

function routerCom(path) { //对路由的component解析 可跳转
    return (resolve) => require([`@/views/${path}`], resolve);
}​
function routerChildren(children) { //对子路由的component解析
    children.forEach(v => {
        v.component = routerCom(v.route);
        if (v.children != undefined) {
            v.children = routerChildren(v.children)
        }
    })
    return children
}